package com.ruoyi.system.service.impl;

import java.util.HashMap;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysWayoftravelMapper;
import com.ruoyi.system.domain.SysWayoftravel;
import com.ruoyi.system.service.ISysWayoftravelService;
import com.ruoyi.common.core.text.Convert;

/**
 * 旅游类型Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-10-12
 */
@Service
public class SysWayoftravelServiceImpl implements ISysWayoftravelService 
{
    @Autowired
    private SysWayoftravelMapper sysWayoftravelMapper;

    /**
     * 查询旅游类型
     * 
     * @param id 旅游类型ID
     * @return 旅游类型
     */
    @Override
    public SysWayoftravel selectSysWayoftravelById(Long id)
    {
        return sysWayoftravelMapper.selectSysWayoftravelById(id);
    }

    /**
     * 查询旅游类型列表
     * 
     * @param sysWayoftravel 旅游类型
     * @return 旅游类型
     */
    @Override
    public List<SysWayoftravel> selectSysWayoftravelList(SysWayoftravel sysWayoftravel)
    {
        return sysWayoftravelMapper.selectSysWayoftravelList(sysWayoftravel);
    }

    /**
     * 新增旅游类型
     * 
     * @param sysWayoftravel 旅游类型
     * @return 结果
     */
    @Override
    public int insertSysWayoftravel(SysWayoftravel sysWayoftravel)
    {
        return sysWayoftravelMapper.insertSysWayoftravel(sysWayoftravel);
    }

    /**
     * 修改旅游类型
     * 
     * @param sysWayoftravel 旅游类型
     * @return 结果
     */
    @Override
    public int updateSysWayoftravel(SysWayoftravel sysWayoftravel)
    {
        return sysWayoftravelMapper.updateSysWayoftravel(sysWayoftravel);
    }

    /**
     * 删除旅游类型对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSysWayoftravelByIds(String ids)
    {
        return sysWayoftravelMapper.deleteSysWayoftravelByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除旅游类型信息
     * 
     * @param id 旅游类型ID
     * @return 结果
     */
    @Override
    public int deleteSysWayoftravelById(Long id)
    {
        return sysWayoftravelMapper.deleteSysWayoftravelById(id);
    }

    @Override
    public HashMap<String,Double> gender() {
        HashMap<String, Double> map=new HashMap<>();
        double gender = sysWayoftravelMapper.gender();
        double manPercent=gender*100;
        map.put("男",manPercent);
        double womanPercent=100-manPercent;
        map.put("女",womanPercent);

        return map;
    }

}
